package com.movie.demo.controller;

import com.movie.demo.Utlis.result.CommonResult;
import com.movie.demo.pojo.Room;
import com.movie.demo.service.RoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
public class RommController {
    @Autowired
    private RoomService roomService;
    @PostMapping("/selectRoom")
    public CommonResult<List> selectRoom(){
        List<Room> rooms=roomService.selectRoom();
        return CommonResult.success(rooms);
    }
    @PostMapping("/updateRoom")
    public CommonResult updateRoom(@RequestBody Room room){
        boolean result=roomService.updateRoom(room);
        return CommonResult.success(result);
    }
}
